package sust.cse.ruhul.jobs1;

import java.util.Date;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.TextView;

public class Page3 extends Activity
{

	private Button		btnSelectedItemLabel;
	private String		val	= null;
	private CheckBox	jobCompletedCheck;
	private TextView	whenKey, whenValue;

	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.page3);
		jobCompletedCheck = (CheckBox) findViewById(R.id.job_completed_check);
		whenKey = (TextView) findViewById(R.id.when_key);
		whenValue = (TextView) findViewById(R.id.when_value);

		btnSelectedItemLabel = (Button) findViewById(R.id.btn_selected_item_label);
		final Intent intent = getIntent();
		// val = intent.getStringExtra("item");
		// btnSelectedItemLabel.setText(val);
	}

	public void onButtonClickOfPage3(final View v)
	{
		switch (v.getId())
		{
		case R.id.btn_service_report:
			final Intent i = new Intent(Page3.this, ServiceReportScreen.class);
			// i.putExtra("item", val);
			startActivity(i);
			break;

		case R.id.btn_client_do:
			final Intent intent = new Intent(Page3.this, Page4.class);
			// intent.putExtra("item", val);
			startActivity(intent);
			break;
		case R.id.job_completed_check:
			if (jobCompletedCheck.isChecked())
			{
				whenValue.setText(new Date().toString());
				whenKey.setVisibility(View.VISIBLE);
				whenValue.setVisibility(View.VISIBLE);
			}
			else
			{
				whenKey.setVisibility(View.VISIBLE);
				whenValue.setVisibility(View.INVISIBLE);
			}
			break;
		}

	}
}
